package cn.kwq.project_manger.pojo;


import cn.kwq.project_manger.pojo.Auditable.Auditable;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.hibernate.annotations.OptimisticLocking;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity //作为hibernate
@Table(name = "Project")
@Builder
@ApiModel(value = "项目信息")
@EqualsAndHashCode(callSuper=false)
@OptimisticLocking(type = org.hibernate.annotations.OptimisticLockType.VERSION)//乐观锁
public class Project extends Auditable<Long> implements Serializable {

    /**
     * 主键
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)//id自增
    @Column(name = "project_id")
    @ApiModelProperty("主键")
    private Long projectId;

    @ApiModelProperty("项目名字")
    private String projectName;

    @ApiModelProperty("报名开始时间")
    @Temporal(TemporalType.DATE)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date startTime;

    @ApiModelProperty("报名结束时间")
    @Temporal(TemporalType.DATE)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endTime;

    @ApiModelProperty("项目开始时间")
    @Temporal(TemporalType.DATE)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date projectStartTime;

    @ApiModelProperty("项目结束时间")
    @Temporal(TemporalType.DATE)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date projectEndTime;

//    private String tagId;

    /**
     * 比赛1项目0
     */
    @ApiModelProperty("项目类型（比赛1项目0）")
    private Integer type;

    /**
     * 学院类型 文0理1 3不分
     */
    @ApiModelProperty("学院类型（文0理1 2不分）")
    private Integer instituteType;

    @ApiModelProperty("地点")
    private String place;

    /**
     * 发起活动的组织/部门
     */
    @ApiModelProperty("发起活动的组织/部门")
    private String createDepartment;

    @ApiModelProperty("专业限制（没限制的时候为空）")
    private String  majorLimit;

    @ApiModelProperty("学院限制（没限制的时候为空）")
    private String instituteLimit;

    /**
     * 审核状态（1通过0不通过 空是未审核）
     */
    @ApiModelProperty("审核状态（1通过0不通过 空是未审核）")
    private Integer status;

    /**
     * 审核不通过的原因
     */
    @ApiModelProperty("审核不通过的原因（没审核和审核通过的话为空）")
    private String reason;


    @ApiModelProperty("发布者联系方式")
    private String connectPublisher;

    @ApiModelProperty("内容")
    private String content;

    @ApiModelProperty("规则")
    private String rule;

    @ApiModelProperty("奖励")
    private String reward;

    @ApiModelProperty("加入方式")
    private String enterWay;

    @ApiModelProperty("创建人id")
    private Long userId;

    @ApiModelProperty("发布人姓名")
    private String createName;


    @Lob
    @ApiModelProperty("项目简介")
    @Basic(fetch = FetchType.LAZY)//文件大，懒加载
    private String briefly;//简介

    /**
     * hibernate 版本控制字段，乐观锁
     */
    @Column(name = "version")
    @ApiModelProperty("乐观锁")
    @Version
    private Integer version;




}
